/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asssql;

import Assignment.BLO.BookBLO;
import Assignment.BLO.OrderBLO;
import Assignment.BLO.UserBLO;
import Assignment.Util.ConnectionUtil;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContext;
import javax.servlet.ServletResponse;

/**
 *
 * @author dieptn
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            //ConnectionUtil.getConnection();
            //        UserDTO user = new UserDTO();
            //        user.setUsername("admin");
            //        user.setPassword("admin");
            //        System.out.println(UserDAO.search(ConnectionUtil.getConnection(), user));
            ////
            //        UserDTO user = new UserDTO();
            //        user.setUsername("admin");
            //        user.setPassword("password");
            //        user.setEmail("email");
            //        user.setRealName("realname");
            //       // user.setAddress("address");
            //        user.setPhone("123345");
            //        user.setDateOfBirth(new Date("2011/11/11 11:11:11"));
            //        user.setCity("HCM");
            //        user.setIsAdmin(false);
            ////        user.setPassword("123");
            // UserDAO.update(ConnectionUtil.getConnection(), user);
            ////        UserDAO.delete(ConnectionUtil.getConnection(), "admin");
            //UserDAO.insert(ConnectionUtil.getConnection(), user);
            //        BookDTO book = new BookDTO();
            //        book.setBookID("1");
            //        book.setTitle("title");
            //        book.setAuthor("author");
            //        book.setPublisher("pub");
            //        book.setDescription("des");
            //        book.setPrice((float) 1.5);
            //        book.setInventory(10);
            //        book.setImageLink("C:\\abc.jpg");
            //        BookBLO bBLO = new BookBLO();
            //        bBLO.getAllBooks();
            //        OrderBLO oBLO = new OrderBLO();
            //        oBLO.getAllOrders();
            //        oBLO.deleteOrderByUsername("user1");
            //        BookDAO.update(ConnectionUtil.getConnection(), book);
            //        BookDAO.delete(ConnectionUtil.getConnection(), "1");
            //        ArrayList list = BookDAO.search(ConnectionUtil.getConnection(), null);
            //        System.out.println(list.size());
            //        UserDTO user = new UserDTO();
            //        user.setUsername("admin");
            //        user.setPassword("admin");
            //        user.setEmail("email");
            //       // user.setRealName("realname");
            //        user.setAddress("addr");
            //        user.setCity("city");
            //        user.setDateOfBirth(new Date("2011/11/11"));
            //        user.setIsAdmin(true);
            //        UserDAO.search(ConnectionUtil.getConnection(), user);
            //BookDAO.search(ConnectionUtil.getConnection(), new BookDTO());
            Properties prop = new Properties();
            InputStream input = Main.class.getClass().getResourceAsStream("/Properties/dbConnection.properties");
            //prop.load(new FileInputStream("dbConnection.properties"));
            prop.load(input);
            String driver = prop.getProperty("driver");
            String url = prop.getProperty("url");
            String username = prop.getProperty("username");
            String password = prop.getProperty("password");
            System.out.println(username + " " + password);
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
